using Avanzis.QueryFramework;
using NUnit.Framework;

namespace Avanzis.QueryBuilder.NUnit.MySql
{
    public class MySqlWhereClauseTest : WhereClauseTest
    {
        private Dialects previousDialect = Dialects.MSSql2005Dialect;

        [TestFixtureSetUp]
        public void Setup()
        {
            previousDialect = QueryFrameworkConfiguration.Dialect;
            QueryFrameworkConfiguration.Dialect = Dialects.MySql;
            QueryBuilder.QueryProcessor.ResetProcessor();
        }

        [TestFixtureTearDown]
        public void TearDown()
        {
            QueryFrameworkConfiguration.Dialect = previousDialect;
        }

        [Test]
        public override void ParametersInWhereClause()
        {
            WhereClause where = new WhereClause();
            where.Filters.Add("TabId", SqlOperator.Equals, "@TabId");
            Assert.AreEqual("WHERE (TabId = @TabId)", where.ToString());
        }
    }
}
